﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;

namespace RI
{
    public class ToResourceLibrary : IDisposable
    {
        /// <summary>
        /// 获取全部新闻
        /// </summary>
        /// <param name="dbName">数据库文件名</param>
        /// <returns>查询结果。格式：编号，标题，内容</returns>
        public DataTable GetAllResultNews(string dbName)
        {
            using (DBase db = new DBase(dbName))
            {
                string sqlCommand = "SELECT title as 标题,content as 内容 FROM Result"; //查询新闻
                string delNullLine = "DELETE * FROM Result WHERE content=''";
                db.GetDataTable(delNullLine);           //删除空行
                return db.GetDataTable(sqlCommand);
            }
        }

        /// <summary>
        /// 释放资源
        /// </summary>
        public void Dispose()
        {
        }
    }
}
